<?php

namespace Services\Log\Models;

use Admin\Models\BaseModel;
class XhlogApplocate extends BaseModel
{

    /**
     *
     * @var integer
     */
    public $iALId;

    /**
     *
     * @var string
     */
    public $iUserId;

    /**
     *
     * @var string
     */
    public $sDeviceId;

    /**
     *
     * @var string
     */
    public $sLogUrl;

    /**
     *
     * @var string
     */
    public $sPackName;

    /**
     *
     * @var string
     */
    public $sLogType;

    /**
     *
     * @var string
     */
    public $mDesc;

    /**
     *
     * @var string
     */
    public $tCreateDate;

    /**
     * Initialize method for model.
     */
    public function initialize()
    {
        $this->setSource("XHLog_AppLocate");
    }

    /**
     * Returns table name mapped in the model.
     *
     * @return string
     */
    public function getSource()
    {
        return 'XHLog_AppLocate';
    }

    /**
     * Allows to query a set of records that match the specified conditions
     *
     * @param mixed $parameters
     * @return XhlogApplocate[]
     */
    public static function find($parameters = null)
    {
        return parent::find($parameters);
    }

    /**
     * Allows to query the first record that match the specified conditions
     *
     * @param mixed $parameters
     * @return XhlogApplocate
     */
    public static function findFirst($parameters = null)
    {
        return parent::findFirst($parameters);
    }

    /**
     * 根据id删除记录并返回结果
     *
     * @param $idArr
     * @return mixed
     *
     * create by ck 20161025
     */
    public static function deleteRecordById($idArr)
    {
        return self::find([
            'conditions'    => 'iALId IN ({idArr:array})',
            'bind'          => [
                'idArr'         => $idArr
            ]
        ])->delete();
    }

}
